package com.wdf.dota;

import java.io.InputStream;

import com.wdf.bean.Meta;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

public class HeroSkillActivity extends Activity {


	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hero_skill);

		try {
		Bundle bundle = this.getIntent().getExtras();
		String heroname =	bundle.getString("heroname");
		if(heroname.equals("kael")){
			setContentView(R.layout.hero_skill_kael);
		}else{
			setContentView(R.layout.hero_skill);
		}
		
		String description	=bundle.getString("herodescription");
		String prop = bundle.getString("heroprop");
		String skill1=	bundle.getString("skill1");
		String skill2 =	bundle.getString("skill2");
		String skill3 = bundle.getString("skill3");
		String skill4 =	bundle.getString("skill4");
		String modinfo678 = bundle.getString("modinfo");
		

			ImageView  skill1map= (ImageView ) findViewById(R.id.skill1map);
			TextView skill1description= (TextView) findViewById(R.id.skill1description);
			ImageView  skill2map = (ImageView ) findViewById(R.id.skill2map);
			TextView skill2description = (TextView) findViewById(R.id.skill2description);
			ImageView  skill3map = (ImageView ) findViewById(R.id.skill3map);
			TextView skill3description = (TextView) findViewById(R.id.skill3description);
			ImageView  skill4map = (ImageView ) findViewById(R.id.skill4map);
			TextView skill4description = (TextView) findViewById(R.id.skill4description);
		    TextView dota678modification = (TextView) findViewById(R.id.dota678modification);
			

			skill1description.setText(Html.fromHtml(skill1));
			skill2description.setText(Html.fromHtml(skill2));
			skill3description.setText(Html.fromHtml(skill3));
			skill4description.setText(Html.fromHtml(skill4));
		//	dota678modification.setText(Html.fromHtml(modinfo678));
			
			String skill1Path =  "dota/"+heroname+"_skill1.png"; 
			String skill2Path = "dota/"+heroname+"_skill2.png"; 
			String skill3Path = "dota/"+heroname+"_skill3.png"; 
			String skill4Path = "dota/"+heroname+"_skill4.png"; 

			InputStream fis1 = getAssets().open( skill1Path);
            Bitmap bm1 = BitmapFactory.decodeStream(fis1);
            skill1map.setImageBitmap(bm1);
			InputStream fis2 = getAssets().open( skill2Path);
            Bitmap bm2 = BitmapFactory.decodeStream(fis2);
            skill2map.setImageBitmap(bm2);
			InputStream fis3 = getAssets().open( skill3Path);
            Bitmap bm3 = BitmapFactory.decodeStream(fis3);
            skill3map.setImageBitmap(bm3);
			InputStream fis4 = getAssets().open( skill4Path);
            Bitmap bm4 = BitmapFactory.decodeStream(fis4);
            skill4map.setImageBitmap(bm4);
            
            
        	if(heroname.equals("kael")){
        		ImageView skillymap = (ImageView) findViewById(R.id.skillymap);
    			TextView skillydescription = (TextView) findViewById(R.id.skillydescription);
    			ImageView skillbmap = (ImageView) findViewById(R.id.skillbmap);
    			TextView skillbdescription = (TextView) findViewById(R.id.skillbdescription);
    			ImageView skillcmap = (ImageView) findViewById(R.id.skillcmap);
    			TextView skillcdescription = (TextView) findViewById(R.id.skillcdescription);
    			ImageView skilldmap = (ImageView) findViewById(R.id.skilldmap);
    			TextView skillddescription = (TextView) findViewById(R.id.skillddescription);
    			ImageView skillfmap = (ImageView) findViewById(R.id.skillfmap);
    			TextView skillfdescription = (TextView) findViewById(R.id.skillfdescription);
    			ImageView skillgmap = (ImageView) findViewById(R.id.skillgmap);
    			TextView skillgdescription = (TextView) findViewById(R.id.skillgdescription);
    			ImageView skilltmap = (ImageView) findViewById(R.id.skilltmap);
    			TextView skilltdescription = (TextView) findViewById(R.id.skilltdescription);
    			ImageView skillvmap = (ImageView) findViewById(R.id.skillvmap);
    			TextView skillvdescription = (TextView) findViewById(R.id.skillvdescription);
    			ImageView skillxmap = (ImageView) findViewById(R.id.skillxmap);
    			TextView skillxdescription = (TextView) findViewById(R.id.skillxdescription);
    			ImageView skillzmap = (ImageView) findViewById(R.id.skillzmap);
    			TextView skillzdescription = (TextView) findViewById(R.id.skillzdescription);
    			
    			skillydescription.setText(Html.fromHtml(Meta.kael_y));
    			skillbdescription.setText(Html.fromHtml(Meta.kael_b));
    			skillcdescription.setText(Html.fromHtml(Meta.kael_c));
    			skillddescription.setText(Html.fromHtml(Meta.kael_d));
    			skillfdescription.setText(Html.fromHtml(Meta.kael_f));
    			skillgdescription.setText(Html.fromHtml(Meta.kael_g));
    			skilltdescription.setText(Html.fromHtml(Meta.kael_t));
    			skillvdescription.setText(Html.fromHtml(Meta.kael_v));
    			skillxdescription.setText(Html.fromHtml(Meta.kael_x));
    			skillzdescription.setText(Html.fromHtml(Meta.kael_z));
    			
    			String skillyPath ="dota/"+ heroname + "_y.png";
    			String skillbPath = "dota/"+heroname + "_b.png";
    			String skillcPath = "dota/"+heroname + "_c.png";
    			String skilldPath ="dota/"+ heroname + "_d.png";
    			String skillfPath = "dota/"+heroname + "_f.png";
    			String skillgPath ="dota/"+ heroname + "_g.png";
    			String skilltPath = "dota/"+heroname + "_t.png";
    			String skillvPath = "dota/"+heroname + "_v.png";
    			String skillxPath = "dota/"+heroname + "_x.png";
    			String skillzPath = "dota/"+heroname + "_z.png";
    			
    			InputStream fisy = getAssets().open(skillyPath);
    			Bitmap bmy = BitmapFactory.decodeStream(fisy);
    			skillymap.setImageBitmap(bmy);
    			InputStream fisb = getAssets().open(skillbPath);
    			Bitmap bmb = BitmapFactory.decodeStream(fisb);
    			skillbmap.setImageBitmap(bmb);
    			InputStream fisc = getAssets().open(skillcPath);
    			Bitmap bmc = BitmapFactory.decodeStream(fisc);
    			skillcmap.setImageBitmap(bmc);
    			InputStream fisd = getAssets().open(skilldPath);
    			Bitmap bmd = BitmapFactory.decodeStream(fisd);
    			skilldmap.setImageBitmap(bmd);
    			InputStream fisf = getAssets().open(skillfPath);
    			Bitmap bmf = BitmapFactory.decodeStream(fisf);
    			skillfmap.setImageBitmap(bmf);
    			InputStream fisg = getAssets().open(skillgPath);
    			Bitmap bmg = BitmapFactory.decodeStream(fisg);
    			skillgmap.setImageBitmap(bmg);
    			InputStream fist = getAssets().open(skilltPath);
    			Bitmap bmt = BitmapFactory.decodeStream(fist);
    			skilltmap.setImageBitmap(bmt);
    			InputStream fisv = getAssets().open(skillvPath);
    			Bitmap bmv = BitmapFactory.decodeStream(fisv);
    			skillvmap.setImageBitmap(bmv);
    			InputStream fisx = getAssets().open(skillxPath);
    			Bitmap bmx = BitmapFactory.decodeStream(fisx);
    			skillxmap.setImageBitmap(bmx);
    			InputStream fisz = getAssets().open(skillzPath);
    			Bitmap bmz = BitmapFactory.decodeStream(fisz);
    			skillzmap.setImageBitmap(bmz);
    		}

		} catch (Exception e) {
			e.printStackTrace();
		}
		
		
	}
}
